package ink.ykb.actDemo.controller;

import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import ink.ykb.actDemo.controller.vo.UserTask;
import ink.ykb.actDemo.entity.Leave;
import ink.ykb.actDemo.entity.UserInfo;
import ink.ykb.actDemo.service.LeaveService;
import ink.ykb.actDemo.service.UserService;
import ink.ykb.actDemo.util.CommonResult;

@Controller
public class MainController {

	@Autowired
    private UserService userService;

	
	@GetMapping(value = "/login")
	public String login() {
		return "login";
	}
    @PostMapping(value = "/login")
    @ResponseBody
    public CommonResult login(UserInfo userInfo) {
    	userService.login(userInfo);
    	return CommonResult.resultSuccess("登陆成功");
    }
    
    @RequestMapping(value = "/index")
    public String index() {
    	return "index";
    }
    
}
